package edu.usc.csci578;

import java.util.List;

import edu.usc.csci578.algorithm.*;
import edu.usc.csci578.manager.*;
import edu.usc.csci578.model.*;
import edu.usc.csci578.util.ModelReader;

public class Main {
	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		ModelReader mr = ModelReader.getInstance();
		ModelManager mm = ModelManager.getInstance();
		mr.load();
		System.out.println("Model building success.");
		System.out.println(mm.countClusters() + " clusters");
		System.out.println(mm.countTopics() + " topics");
		System.out.println(mm.countClasses() + " classes");
		System.out.println(mm.countMethods() + " methods");
		System.out.println(mm.countEdges() + " edges");
		System.out.println("loaded.");

		testWang();
	}
	
	public static void testWang() throws Exception
	{
		AlgorithmManager am = AlgorithmManager.getInstance();
		am.putInQueue(new DependencyMeshAlgorithm());
		//am.putAllInQueue();
		am.execute();
	}
	
	
	public static void testQian() throws Exception 
	{
		AlgorithmManager am = AlgorithmManager.getInstance();
		//am.registerAlgorithm(new SelfRefAlgorithm());
		//am.putInQueue(new SelfRefAlgorithm());
		am.putInQueue(am.getAlgorithmByName("DependencyMesheAlgorithm"));
		am.execute();
		// testTopic(mr);
		System.out.println("End");
	}
	
	/*
	 * public static void testTopic(ModelReader mr) throws Exception {
	 * ModelManager store = ModelManager.getInstance();
	 * System.out.println("Topics#:"+store.countTopics()); List<Cluster>
	 * clusters = store.getAllClusters(); for( Cluster cluster : clusters) { for
	 * (DocTopic dTopic : cluster.getTopics()) {
	 * if(dTopic.getType()==DocTopic.TYPE_UNSPEC) throw new
	 * Exception("Unspecified DocTopic Type");
	 * if((dTopic.getType()==DocTopic.TYPE_SPEC)!=(dTopic.getTopic().isSpec()))
	 * throw new Exception("DocTopic type not necessarily conforms to Topic"); }
	 * } System.out.println("All DocTopics must be chosen from Topics\n"); }
	 */
}